package implementation1.data;

import interfaces.data.IAccount;

/**
 * Class which represents standard account.
 *
 * @author Jan Svab
 *         Created 15.10.11
 */
public class Account implements IAccount
{
    public static int NO_USER = 0;
    /**
     * Role ID of normal user
     */
    public static int NORMAL_USER = 1;

    /**
     * Username
     */
    private String nick;
    /**
     * Password
     */
    private String password;
    /**
     * ID of user role
     */
    private int role;

    /**
     * Default constructor.
     *
     * @param nick     username
     * @param password password
     * @param role     a role of user
     */
    public Account(String nick, String password, int role)
    {
        this.nick = nick;
        this.password = password;
        this.role = role;
    }


    /**
     * Return a nick of user.
     *
     * @return the nick of user.
     */
    @Override
    public String getNick()
    {
        return nick;
    }

    /**
     * Return a password of user.
     *
     * @return the password of user
     */
    @Override
    public String getPassword()
    {
        return password;
    }

    /**
     * Return a number of role of user.
     *
     * @return user's role number
     */
    @Override
    public int getRole()
    {
        return role;
    }

    /**
     * Return a name of role of user.
     *
     * @return the user's role name
     */
    @Override
    public String getRoleName()
    {
        if (role == NORMAL_USER)
        {
            return "USER";
        }

        return "UNKNOWN";
    }
}
